<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        //使用const声明常量
        // const PI=3.14159;
        // console.log(PI);
        // PI=3;
        // console.log(PI);      //TypeError: Assignment to constant variable.

        //使用const命令声明常量初始化
        // const foo;      //SyntaxError: Missing initializer in const declaration
        
        //const声明常量的作用域
        if(true){
            const MAX=5;
        }
        console.log(MAX);      //ReferenceError: MAX is not defined
    </script>
</body>
</html>